package scjp;

class Animal{
	
	protected void mytest(){
		System.out.println("protected test");
	}
	public void eat(){
		System.out.println("Animal eat");
	}
	
	private  final void test(){
		System.out.println("test method");
	}
}
class Cat extends Animal{
	@Override
	public void eat(){
		System.out.println("Cat eat");
	}
	
	public void move(){
		System.out.println("Cat move");
	}
}
class Dog extends Animal{
	@Override
	public void eat(){
		System.out.println("Dog eat");
	}
	public void bark(){
		System.out.println("Dog bark");
	}
}
public class MyTest11 {
	
	public static void main(String... args) {
        Cat cat =null;
        Dog dog =null;
        Animal animal = new Cat();
        animal.mytest();
        animal = new Dog();
        if(animal instanceof Cat){
        	cat = (Cat)animal;
        	cat.eat();
        	cat.move();
        }
        if(animal instanceof Dog){
        	dog = (Dog)animal;
        	dog.eat();
        	dog.bark();
        }
        
	}

}
